<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
		
		<title>jQuery Spell Checker for NicEdit</title>
		<link rel="stylesheet" type="text/css" media="screen" href="nicedit_files/screen.css" />
		<link rel="stylesheet" type="text/css" media="screen" href="nicedit_files/spellchecker.css" />
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
		<script type="text/javascript" src="nicedit_files/jquery.js"></script>
		<script type="text/javascript" src="nicedit_files/jquery-impromptu.js"></script>
		<script type="text/javascript" src="nicedit_files/jquery.spellchecker.js"></script>
		<script type="text/javascript" src="nicedit_files/jquery-impspeller.js"></script>
		<script type="text/javascript" src="nicedit_files/jquery.spellchecker.js"></script>
		<script type="text/javascript">
			
			//------------------------------------------
			// create the button for spellcheck
			//------------------------------------------
			var nicExampleOptions = {
				buttons : { 'spellcheck' : {name : __('Check Spelling'), type : 'nicEditorSpellCheckButton' } },
				iconFiles : { 'spellcheck' : 'img/spellcheck.gif' }
			};

			var nicEditorSpellCheckButton = nicEditorButton.extend({   
				mouseClick : function() { 
					runImpspellerNicEdit(this.ne.selectedInstance);
				}
			});

			nicEditors.registerPlugin(nicPlugin,nicExampleOptions);
			
			//------------------------------------------
			// create the editor
			//------------------------------------------
			bkLib.onDomLoaded(function(){
				new nicEditor({buttonList : ['fontSize','bold','italic','underline','html','spellcheck']}).panelInstance('spellcheckContent');
			});
			
			
			//------------------------------------------
			// our function to check spelling
			//------------------------------------------
			function runImpspellerNicEdit(instance){
				var editor = instance;
				var mp = editor.getContent();
		
				$.impspeller(mp,{
					success: function(text,html,el){
						editor.setContent(html);
						editor.saveContent();
					}
				});
			}
		</script>
	</head>
	<body>
	
		<h1>jQuery Spell Checker for NicEdit</h1>
		
		<br />
		
		<textarea name="spellcheckContent" id="spellcheckContent">Some sample txt goes in here for spel chek.</textarea>
		<br />
		<a href="javascript:runImpspellerNicEdit(nicEditors.findEditor('spellcheckContent'));" id="impcheck">imp check</a>
	
	</body>
</html>
